var t,
  a = require("../../@babel/runtime/helpers/defineProperty"),
  o = require("../../res/www.a9a.cn.js"),
  i = getApp();
Page({
  data: {
    id: 1,
    mask_class: "alpha0_100",
    div_outlist_box_class: "div_upAnm1",
  },
  onLoad: function (t) {
    var a = this,
      n = this;
    i.get_config("_ZEAI").then(function (t) {
      n.setData({ color: i._ZEAI.color, rgbcolor: o.c16_rgb(i._ZEAI.color) }),
        wx.setNavigationBarColor({
          backgroundColor: i._ZEAI.color,
          frontColor: "#ffffff",
        }),
        wx.setBackgroundColor({ backgroundColorTop: i._ZEAI.color });
    }),
      i.get_openid().then(function (t) {
        a.init();
      });
  },
  init: function () {
    var a = this;
    wx.showLoading({ title: "拼命加载中...", mask: !0 }),
      wx.showNavigationBarLoading(),
      (t = wx.getStorageSync("COOK_U")),
      i.ajax({
        url: "manghe.php",
        data: { submitok: "manghe_detail", openid: t.openid, id: a.data.id },
        success: function (t) {
          1 == t.flag
            ? (a.setData({
                nTitle: t.D.title,
                D: t.D,
                BM: t.BM,
                MARQUEE: t.MARQUEE,
                content: o.escape2Html(t.D.content),
                ios_ifpay: t.ios_ifpay,
              }),
              wx.setNavigationBarTitle({ title: t.D.title }),
              wx.setBackgroundColor({ backgroundColorTop: a.data.color }))
            : wx.showToast({ title: t.msg, icon: "none", mask: !0 }),
            wx.hideLoading(),
            wx.hideNavigationBarLoading();
        },
      });
  },
  btn_inFn: function () {
    var a = this;
    wx.showLoading({ title: "玩命加载中", mask: !0 }),
      i.ajax({
        url: "manghe.php",
        data: { submitok: "chkin", openid: t.openid, id: a.data.id },
        success: function (n) {
          wx.hideLoading(),
            1 == n.flag
              ? a.setData({ div_in_form: !0 })
              : "pay" == n.flag
              ? 1 != a.data.ios_ifpay.flag
                ? wx.getSystemInfo({
                    success: function (n) {
                      "ios" == n.platform
                        ? wx.showModal({
                            title: "温馨提示",
                            content: a.data.ios_ifpay.tips,
                            confirmColor: a.data.color,
                            cancelText: "返回",
                            confirmText: "联系服务人员",
                            success: function (t) {
                              t.confirm
                                ? wx.redirectTo({ url: "../my/hongniang" })
                                : t.cancel && wx.navigateBack();
                            },
                          })
                        : i.pay({
                            data: {
                              submitok: "manghe_pay",
                              openid: t.openid,
                              id: a.data.id,
                            },
                            success: function (t) {
                              a.setData({ div_in_form: !0 });
                            },
                            fail: function (t) {
                              (t.this = a), (t.url = "no"), o.sorry(t);
                            },
                          });
                    },
                  })
                : i.pay({
                    data: {
                      submitok: "manghe_pay",
                      openid: t.openid,
                      id: a.data.id,
                    },
                    success: function (t) {
                      a.setData({ div_in_form: !0 });
                    },
                    fail: function (t) {
                      (t.this = a), (t.url = "no"), o.sorry(t);
                    },
                  })
              : ((n.this = a), (n.url = "no"), o.sorry(n));
        },
      });
  },
  btn_insubmitFn: function (a) {
    var n = this,
      e = a.detail.value;
    i.empty(e.sex)
      ? wx.showToast({ title: "请选择本人【性别】", icon: "none", mask: !0 })
      : i.ifweixin(e.weixin)
      ? wx.showModal({
          title: "",
          content:
            "确定本人资料真实么？否则将行进封号，并上报IP交由公安机关处理",
          confirmColor: n.data.color,
          cancelText: "取消",
          confirmText: "确定",
          success: function (a) {
            a.confirm &&
              (wx.showLoading({ title: "正在保存", mask: !0 }),
              i.ajax({
                url: "manghe.php",
                data: {
                  submitok: "add_update",
                  openid: t.openid,
                  id: n.data.id,
                  sex: e.sex,
                  weixin: e.weixin,
                  aboutus: e.aboutus,
                  photo_s: e.photo_s,
                },
                success: function (t) {
                  wx.hideLoading(),
                    1 == t.flag
                      ? wx.showModal({
                          content: t.msg,
                          confirmColor: n.data.color,
                          confirmText: "朕知道了",
                          showCancel: !1,
                          success: function (t) {
                            n.setData({ div_in_form: !1 }),
                              n.onPullDownRefresh();
                          },
                        })
                      : ((t.this = n), (t.url = "no"), o.sorry(t));
                },
              }));
          },
        })
      : wx.showToast({
          title: "请输入本人【微信或手机】",
          icon: "none",
          mask: !0,
        });
  },
  photo_s_addFn: function () {
    var a = this;
    wx.chooseMedia({
      count: 1,
      mediaType: ["image"],
      sourceType: ["album", "camera"],
      sizeType: ["compressed"],
      success: function (n) {
        a.setData({ photo_s: n.tempFiles[0].tempFilePath }),
          wx.uploadFile({
            url: i.WWW + "/api/wxxcx/manghe.php",
            filePath: n.tempFiles[0].tempFilePath,
            name: "pic",
            formData: { submitok: "up", openid: t.openid },
            success: function (t) {
              1 == (t = o.jsoneval(t.data)).flag
                ? a.setData({ photo_s_dbname: t.dbname })
                : wx.showModal({
                    content: t.msg,
                    confirmColor: a.data.color,
                    confirmText: "朕知道了",
                    showCancel: !1,
                    success: function (t) {},
                  });
            },
          });
      },
    });
  },
  btn_outFn: function () {
    var a = this;
    wx.showLoading({ title: "玩命加载中", mask: !0 }),
      i.ajax({
        url: "manghe.php",
        data: { submitok: "chkout", openid: t.openid, id: a.data.id },
        success: function (n) {
          1 == n.flag
            ? a.setData({ OUT: n.OUT, div_out_form: !0 })
            : "pay" == n.flag
            ? 1 != a.data.ios_ifpay.flag
              ? wx.getSystemInfo({
                  success: function (n) {
                    "ios" == n.platform
                      ? wx.showModal({
                          title: "温馨提示",
                          content: a.data.ios_ifpay.tips,
                          confirmColor: a.data.color,
                          cancelText: "返回",
                          confirmText: "联系服务人员",
                          success: function (t) {
                            t.confirm
                              ? wx.redirectTo({ url: "../my/hongniang" })
                              : t.cancel && wx.navigateBack();
                          },
                        })
                      : i.pay({
                          data: {
                            submitok: "manghe_pay",
                            openid: t.openid,
                            id: a.data.id,
                          },
                          success: function () {
                            a.btn_outFn();
                          },
                          fail: function (t) {
                            (t.this = a), (t.url = "no"), o.sorry(t);
                          },
                        });
                  },
                })
              : i.pay({
                  data: {
                    submitok: "manghe_pay",
                    openid: t.openid,
                    id: a.data.id,
                  },
                  success: function () {
                    a.btn_outFn();
                  },
                  fail: function (t) {
                    (t.this = a), (t.url = "no"), o.sorry(t);
                  },
                })
            : ((n.this = a), (n.url = "no"), o.sorry(n)),
            wx.hideLoading();
        },
      });
  },
  back: function () {
    this.setData({ div_login: !1 });
  },
  copywxFn: function (t) {
    o.copy_text({ data: this.data.OUT.weixin, msg: "复制成功" });
  },
  outlistFn: function () {
    var a = this;
    wx.showLoading({ title: "玩命加载中", mask: !0 }),
      i.ajax({
        url: "manghe.php",
        data: { submitok: "outlist", openid: t.openid, id: a.data.id },
        success: function (t) {
          wx.hideLoading(),
            1 == t.flag
              ? a.setData({ OUTLIST: t.OUTLIST, div_outlist: !0 })
              : wx.showToast({ title: t.msg, icon: "none", mask: !0 });
        },
      });
  },
  copywxFn2: function (t) {
    var a = t.currentTarget.dataset.weixin;
    o.copy_text({ data: a, msg: "复制成功" });
  },
  div_in_form_closeFn: function () {
    this.setData({ div_in_form: !1, div_out_form: !1 });
  },
  onPageScroll: function (t) {
    t.scrollTop > 100
      ? this.setData({ backtop_flag: !0 })
      : this.setData({ backtop_flag: !1 });
  },
  backtopFn: function () {
    wx.pageScrollTo({ scrollTop: 0 });
  },
  mask_closeFn: function (t) {
    var o = this,
      i = t.currentTarget.dataset.maskid;
    this.setData({
      mask_class: "alpha100_0",
      div_outlist_box_class: "div_upAnm2",
    }),
      setTimeout(function () {
        var t;
        o.setData(
          (a((t = {}), i, !1),
          a(t, "mask_class", "alpha0_100"),
          a(t, "div_outlist_box_class", "div_upAnm1"),
          t)
        );
      }, 500);
  },
  emptyFn: function () {},
  vipFn: function () {
    i.chklogin().then(function (t) {
      t
        ? wx.navigateTo({ url: "../my_vip/my_vip" })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  certFn: function () {
    i.chklogin().then(function (t) {
      t
        ? wx.navigateTo({ url: "../my/cert" })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  dataFn: function () {
    i.chklogin().then(function (t) {
      t
        ? wx.navigateTo({ url: "../reg/reg" })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  getPhoneNumber: function (t) {
    i.getPhoneNumber({ e: t, url: "../my/my" });
  },
  onPullDownRefresh: function () {
    var t = this;
    wx.vibrateShort({ type: "heavy" }),
      setTimeout(function () {
        wx.stopPullDownRefresh(), t.init();
      }, 500);
  },
  onShareAppMessage: function (t) {
    return {
      imageUrl: this.data.D.path_b,
      title: this.data.D.wxshareC,
      path: "/pages/box/box2",
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.data.D.path_b,
      title: this.data.D.wxshareC,
      query: "",
      path: "/pages/box/box2",
    };
  },
  ifagreeFn: function (t) {
    1 == t.detail.value
      ? this.setData({ ifagree: !0 })
      : this.setData({ ifagree: !1 });
  },
  ifagree_passFn: function () {
    wx.showToast({
      title: "请先点击同意《用户协议》和《隐私条款》",
      icon: "none",
      mask: !0,
      duration: 3e3,
    });
  },
});
